-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor apparmor utils in e2e #84439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
I think this change makes a lot of sense. Would also love someone with more direct ownership of test/e2e
to sign-off that framework
is the proper home.
Also, would love you mind addressing the golint
errors? Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for working on this @danielqsj !
Added a couple comments to guide the refactoring into the e2e test framework.
Overall, we want to include any code that may be useful for a user to test behaviour, if there is code that is specific to a test then the code should stay within the test.
A big thing is that function within an e2e test framework (test/e2e/framework/<pkg>
) should not import the e2e test framework in order to avoid circular dependencies and to keep a clean interface.
A lof of the functions that are being moved over are of the form
func someMethod(f *framework.Framework) {
...
}
All these functions should be refactored to instead use the thing that is required from the test framework.
For example, a lof of code does something like f.ClientSet.CoreV1().ConfigMaps(f.Namespace.Name).Create(cm)
. This should be refactored to instead take a client interface and a namespace string as arguments to have ClientSet.CoreV1().ConfigMaps(Namespace).Create(cm)
within the method.
/priority important-soon
/lgtm cancel
/milestone v1.17
@alejandrox1 thanks for your review. It's a great guideline for this series of refactors. |
Thanks for your insights here @alejandrox1 ! |
Hi, bug triage for v1.17 checking in to see if this PR will be merged before code freeze on Nov. 14? |
/cc @oomichi |
test/e2e/framework/apparmor.go
Outdated
@@ -23,7 +23,6 @@ import ( | |||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |||
"k8s.io/apimachinery/pkg/labels" | |||
"k8s.io/kubernetes/pkg/security/apparmor" | |||
"k8s.io/kubernetes/test/e2e/framework" | |||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency way is not valid (e2e core framework to e2e framework subpackages(e2epod
in this case).
I hesitate to merge this into the core framework at this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't like this dependency here.
But if we looks into other files in framework, there are many place also has this dependency issue.
We need to sort out the calling relationship of each components of e2e framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we looks into other files in framework, there are many place also has this dependency issue.
Yes, you are right.
Then we are trying to remove such invalid dependencies from the existing places.
I feel it is not necessary to add more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oomichi does one e2e framework subpackages has dependency of another e2e framework subpackage seems good ?
If it's good, I can move the apparmor.go
to a dedicated subpackage like security
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this will add the dependency of the package e2e/framework
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue to track this issue: #85193
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oomichi does one e2e framework subpackages has dependency of another e2e framework subpackage seems good ?
That is a nice point. IIUC we never discussed the dependency between subpackages.
I guess the dependency could be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. Re-implemented this change by moving it to a new subpackage.
@oomichi Please help review it ? Thanks
@oomichi Do you think that this will be merged before v1.17 code freeze 11/14 5pm pacific time? |
It's up to @danielqsj if we can see a PR which has clean dependency. |
7d583c5
to
2aee2e3
Compare
2aee2e3
to
920dbdd
Compare
PR updated |
@danielqsj Thanks for updating, much better for me. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielqsj, oomichi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
/sig testing
What this PR does / why we need it:
test/e2e/common
is a mixture of tests (test/e2e/common/downward_api.go
) and utility code (test/e2e/common/events.go
). It would be nice to refactor it so that the utility code can be imported without also importing the tests. Most likely a better place for the utility code is undertest/e2e/framework
.Which issue(s) this PR fixes:
part of #83937
Special notes for your reviewer:
/cc @pohly
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: